package com.dy.basic.config;

import com.dy.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;


    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/logininfo/accountLogin",  // 登录
                        "/verifyCode/**", // 验证码
                        "/fastDfs/**", // 放行fastDfs
                        "/shop/settlement/**", // 店铺入驻
                        "/user/phoneRegister/**", // 手机注册
                        "/user/emailRegister/**", // 手机注册
                        "/login/**" // 扫码注册
                );
    }
}
